package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Yun_DianXing extends SwordCard {
    /**
     * title:云剑·点星
     * effect:灵气加2/3/4（每剩余一点灵气多一攻）
     */
    public Yun_DianXing(@Value("1") int lvl) {
        super("云剑·点星");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("灵气加2/3/4（每剩余1点灵气多1攻）");

        if (1 == lvl) {
            this.setSpiritAdd(2);
        } else if (2 == lvl) {
            this.setSpiritAdd(3);
        } else if (3 == lvl) {
            this.setSpiritAdd(4);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.getPlayerBuff().addSpiritualEnergy(this.getSpiritAdd());
        int damag = Sta1.getPlayerBuff().getSpiritualEnergy();
        Sta1.attack(Sta2, damag);
        Sta1.getPlayerBuff().clearSwordIntent();
        return true;
    }
}
